﻿using Microsoft.Security.Application;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Ec_System.API;
using Ec_System.Facade.Web;

namespace Ec_System.WebUI.Areas.Web.Controllers
{
    public class QrCodeController : Controller
    {
        QrCodeFacade qrCodeFacade = new QrCodeFacade();

        // GET: Web/QrCode
        [HttpGet]
        public ActionResult Index()
        {
            return View();
        }

        [HttpPost]
        
        public ActionResult Index(FormCollection formCollection)
        {
            string code = Sanitizer.GetSafeHtmlFragment(formCollection["qrCode"]);
            string ip = GetIP.GetClientIP();
            var model = qrCodeFacade.GetQrInfoByCode(code, ip);
            
            return View(model);
        }
    }
}